#!/bin/bash

# cjgit - Help Command
# Show help message for cjgit commands

# Source common functions
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/cjgit-common.sh"

# Help command implementation
help_command() {
    echo "Usage: cjgit [COMMAND] [OPTIONS]"
    echo
    echo "Cangjie Git Manager - Manage multiple Cangjie git repositories"
    echo
    echo "Commands:"
    echo "  clone   - Clone all Cangjie projects (dev branch)"
    echo "  new     - Create a new branch from upstream/dev in all projects"
    echo "  pull    - Update all Cangjie projects with latest changes from remote"
    echo "  push    - Push all Cangjie projects to myfork or default remote"
    echo "  pr      - Prepare and create PR for changes across projects"
    echo "  status  - Show status of all Cangjie projects"
    echo "  help    - Show this help message"
    echo
    echo "Clone Options:"
    echo "  --fork=username   Also add fork remote for the specified username"
    echo
    echo "Push Options:"
    echo "  --force           Force push (overwrites remote history)"
    echo
    echo "Projects managed:"
    for project in "${PROJECTS[@]}"; do
        echo "  - $project"
    done
    echo
    echo "Examples:"
    echo "  cjgit clone                    # Clone all projects (dev branch) with upstream remote"
    echo "  cjgit clone --fork=myusername  # Clone dev branch and add fork remote"
    echo "  cjgit new feature-branch       # Create new branch from upstream/dev in all projects"
    echo "  cjgit pull                     # Update all projects"
    echo "  cjgit push                     # Push all projects to myfork or default remote"
    echo "  cjgit push --force             # Force push all projects"
    echo "  cjgit pr \"Fix login issue\"    # Create PR for changes across projects"
    echo "  cjgit status                   # Show status of all projects"
}

# Main execution
help_command